<?php
/**
 * Add feed procedure - confirm addiction
 *
 * @author University of London Computer Centre
 * @version 1.4.0 - Release Candidate 2
 * @package ArchivePress
 * @subpackage pages
 * @global ArchivePress $ArchivePress
 */

// globals
global $ArchivePress;

// actions URL
$responder = get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=archivepress/pages/responder.php';

// get feed
$feed = $ArchivePress->getFeed($ArchivePress->getTmpOption(WP_ARCHIVEPRESS_PREFIX . "intermediateid"));

echo '<div class="wrap">
        <div class="icon32" id="icon-archivepress"><br /></div>
        <h2>'.__("Add Feed", ARCHIVEPRESS).'</h2>
        '.$message.'
        <form method="post" action="admin.php?page=archivepress/pages/add-feed-confirm.php" >
            <input type="hidden" name="back" value="add-feed" />
            <input type="hidden" name="added" value="1" />
            <input type="hidden" name="' . WP_ARCHIVEPRESS_PREFIX . 'action" value="addfeedconfirm" />';

// security
wp_nonce_field(WP_ARCHIVEPRESS_PREFIX . 'addfeedconfirm');

// feed options
$options .= __("Feed Active", ARCHIVEPRESS).": ".$feed["active"]."<br />";
$options = __("Protocol", ARCHIVEPRESS).": ".$feed["protocol"]."<br />";
$options .= __("Interval", ARCHIVEPRESS).": ".$feed["interval"]."<br />";
$options .= __("Fetch also Comments", ARCHIVEPRESS).": ".$feed["comments"]."<br />";
$options .= __("Follow PermaLinks", ARCHIVEPRESS).": ".$feed[WP_ARCHIVEPRESS_PREFIX . "followPermaLink"]."<br />";
$options .= __("Embed Media", ARCHIVEPRESS).": ".$feed[WP_ARCHIVEPRESS_PREFIX . "embedMedia"]."<br />";
$options .= __("Default Posts status", ARCHIVEPRESS).": ".$feed[WP_ARCHIVEPRESS_PREFIX . "defPostStatus"]."<br />";
$options .= __("Try to find the Excerpt", ARCHIVEPRESS).": ".$feed[WP_ARCHIVEPRESS_PREFIX . "tryToFindExcerpt"]."<br />";
$options .= __("Default Comment status", ARCHIVEPRESS).": ".$feed[WP_ARCHIVEPRESS_PREFIX . "defCommentsStatus"]."";


// check if add the whole blog
$blog = __("NO", ARCHIVEPRESS);
if($ArchivePress->getTmpOption(WP_ARCHIVEPRESS_PREFIX . "feedfileuploaded") == "yes") {
    $blog = __("YES", ARCHIVEPRESS);
}

// check if save also the contributor
$contributor = __("NO", ARCHIVEPRESS);
if(get_option(WP_ARCHIVEPRESS_PREFIX . "saveContributors") == "yes") {
    $contributor = __("YES", ARCHIVEPRESS);
}

echo'
            <h3>'.__("Confirm you want to add the Feed", ARCHIVEPRESS).'</h3>
            <table class="form-table">
                <tr valign="top">
                    <th scope="row">'.__("Feed name", ARCHIVEPRESS).'</th>
                    <td>
                        '.$ArchivePress->cleanOutput($feed["name"]).'
                    </td>
                </tr>
                <tr valign="top">
                    <th scope="row">'.__("Posts will be added", ARCHIVEPRESS).'</th>
                    <td>
                        '.$ArchivePress->getPostsForFeed($feed["id"]).'
                    </td>
                </tr>
                <tr valign="top">
                    <th scope="row">'.__("Feed Options", ARCHIVEPRESS).'</th>
                    <td>
                        '.$options.'
                    </td>
                </tr>
                <tr valign="top">
                    <th scope="row">'.__("Save Contributor", ARCHIVEPRESS).'</th>
                    <td>
                        '.$contributor.'
                    </td>
                </tr>
                <tr valign="top">
                    <th scope="row">'.__("Add also the whole Blog", ARCHIVEPRESS).'</th>
                    <td>
                        '.$blog.'
                    </td>
                </tr>
            </table>
            <br />

            <p class="submit">
                <input type="submit" class="button-primary" value="'.__('Add Feed', ARCHIVEPRESS).'" />
                 '.__("or", ARCHIVEPRESS).' <a title="'.__("cancel", ARCHIVEPRESS).'" href="admin.php?page=archivepress/pages/add-feed.php">'.__("Cancel", ARCHIVEPRESS).'</a>
            </p>';


echo '
        </form>
     </div>';
?>